﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace MySound
{
	public partial class MainForm : Form
	{
		private WaveFile m_waveFile;

		public MainForm()
		{
			InitializeComponent();
		}

        private void button1_Click(object sender, EventArgs e)
        {
            openFileDialog1.Filter = "Wave Files (*.wav)|*.wav|"+ "All Files (*.*)|*.*";       
            openFileDialog1.FileName = "A96.WAV";
            DialogResult result = openFileDialog1.ShowDialog();
            if (result == DialogResult.OK)
            {
                textBox1.Text = openFileDialog1.FileName;
                button2.Enabled = true;
            }
        }

		private void button2_Click(object sender, EventArgs e)
		{

			m_waveFile = new WaveFile(openFileDialog1.FileName);
            m_waveFile.Read();
            WaveForm swf = new WaveForm(m_waveFile);
			swf.ShowDialog();
            
		}

		private void button3_Click(object sender, EventArgs e)
		{
			this.Close();
		}

        private void MainForm_KeyDown(object sender, KeyEventArgs e)
        {
            switch (e.KeyData)
            {
                case Keys.Escape:
                    Close();
                    break;
                case Keys.O:
                    button2_Click(null, null);
                    break;
                case Keys.Tab:
                    ProcessTabKey(true);
                    break;
            }
        }


	}
}
